package com.nacos.example.config;

import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author wy
 * @date 2022/04/24
 * @description NacosPropertySource和ConfigurationProperties结合读取指定路径的文件
 * 可以实现nacos配置中心配置文件热更新，nacos配置中心文件修改发布后，这里可以读取到修改后的值
 */
@Component
@NacosPropertySource(dataId = "config-teacher.yml", autoRefreshed = true)
@ConfigurationProperties(prefix = "teacher")
public class TestConfiguration3 {

    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
